import Vue from 'vue'
import App from './App'
import router from './router'
import pull from './com/pull';

Vue.config.productionTip = false

Vue.component('pull', pull)

Vue.prototype.jump = function(path, pm) {
	sessionStorage.isForward = 1;
	if(pm) {
		pmto(path, pm)
	} else {
		pmto(path)
	}
}
//用来全局监视滚动条高度值
global.distanceTop = {
	val: 0
};
Vue.prototype.atScorll = function(back, path) {
	var vm = this;
	var path = vm.$route.path;
	Object.defineProperty(distanceTop, 'val', {
		set: function(val) {
			if(path == vm.$route.path) {
				back(val);
			}
		}
	})
}

//下拉请求返回数据
global.pullData={
	val:''
}
Vue.prototype.pullBack = function(back, path) {
	var vm = this;
	var path = vm.$route.path;
	Object.defineProperty(pullData, 'val', {
		set: function(val) {
			if(path == vm.$route.path) {
				back(val);
			}
		}
	})
}

//页面调用atScorll方法
//this.atScorll(function(val) {
//				console.log(val);
//})

/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	render: h => h(App)
})